<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../day02/jquery-1.9.0.js"></script>
    <title>cros</title>
    <script>
        function doAjax() {
            $.ajax({
                url: 'http://localhost/ajax/day02/selectAllProduct.php',
                type: 'post',
                dataType: 'json'
            }).done(result=>{
                console.log('result:', result);
            });
        }

        function doSome() {
            // 对方服务器未实现CORS, 无法获取数据
            $.ajax({
                url: 'https://wis.qq.com/weather/common',
                type: 'get',
                data: 'source=pc&weather_type=observe|forecast_1h|forecast_24h|index|alarm|limit|tips|rise&province=江苏省&city=南京市&county=',
                dataType: 'json'
            }).done((result)=>{
                console.log('result:', result);
            });
        }

        function doCheck(){
            let url = "https://api.asilu.com/idcard/";
            $.ajax({
                url: url,
                type: 'get',
                data: 'id=' + document.getElementById("card").value,
                dataType: 'jsonp'
            }).done((result)=>{
                console.log('result:', result);
            });
        }
    </script>
</head>
<body>
    <button onclick="doAjax()" >btn</button>
    <button onclick="doSome()" >doSome</button>
    <hr>
    <input type="text" id="card" >
    <button onclick="doCheck()" >doCheck</button>
</body>
</html>